﻿namespace Blaze.Editor
{
    using System.Diagnostics;

    /// <summary>
    /// 为explorer的调用提供常用功能。
    /// </summary>
    public class ExplorerUtility
    {
        /// <summary>
        /// 在Explorer中显示指定文件/目录。
        /// </summary>
        /// <param name="path">路径</param>
        /// <param name="isDirectory">路径是否为文件夹</param>
        public static void Show(string path, bool isDirectory)
        {
            path = path.Replace("/", @"\");
            var process = new Process {StartInfo = {FileName = "explorer.exe"}};
            if (isDirectory)
                process.StartInfo.Arguments = string.Format("/root, {0}", path);
            else
                process.StartInfo.Arguments = string.Format("/select, {0}", path);
            process.Start();
        }
    }
}